From 22abd373134fb2ec0d9dbc615a49431515e7b22a Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Wed, 12 Oct 2005 18:43:26 +0100 Subject: [PATCH] Disable watch callbacks while running the driver probe callback. Signed-off-by: Christian Limpach --- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c | 8 +++++++- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index 09d0d8db95..4471f10d32 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -39,6 +39,8 @@ #include #include "xenbus_comms.h" +extern struct semaphore xenwatch_mutex; + #define streq(a, b) (strcmp((a), (b)) == 0) static struct notifier_block *xenstore_chain; @@ -205,6 +207,7 @@ static int xenbus_dev_probe(struct device *_dev) struct xenbus_device *dev = to_xenbus_device(_dev); struct xenbus_driver *drv = to_xenbus_driver(_dev->driver); const struct xenbus_device_id *id; + int ret; if (!drv->probe) return -ENODEV; @@ -213,7 +216,10 @@ static int xenbus_dev_probe(struct device *_dev) if (!id) return -ENODEV; - return drv->probe(dev, id); + down(&xenwatch_mutex); + ret = drv->probe(dev, id); + up(&xenwatch_mutex); + return ret; } static int xenbus_dev_remove(struct device *_dev) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index ad44cf100a..efaffe2393 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -92,7 +92,7 @@ static DEFINE_SPINLOCK(watch_events_lock); * carrying out work. */ static pid_t xenwatch_pid; -static DECLARE_MUTEX(xenwatch_mutex); +/* static */ DECLARE_MUTEX(xenwatch_mutex); static DECLARE_WAIT_QUEUE_HEAD(watch_events_waitq); static int get_error(const char *errorstring) -- 2.30.2